gh-132732: Fix up pure types in JIT#136050
Conversation
|
How do you feel about recursively checking the tuple's elements for safety? Something like: if (typ == &PyTuple_Type) {
Py_ssize_t length = _Py_uop_sym_tuple_length(sym);
if (length < 0) {
return false;
}
for (Py_ssize_t i = 0; i < length; i++) {
if (!_Py_uop_sym_is_safe_const(ctx, sym)) {
return false;
}
}
return true;
}Potential downside is that in theory, the tuples could be huge. We could set an upper bound of a maximum of a few elements or something, though (but that gets tricky with the recursion, which could be arbitrarily deep too). |
|
The tuples in the optimizer are limited to a size of 6, though that could recursively go on for a long time... I think it's not worth thinking over. I don't think it's a common thing to use tuples in a "constant" way to do operations on. If they are, they would use lists instead. Unless of course they want to program in an immutable fashion. |
|
Constant tuples can be arbitrary size. This constant evaluation doesn’t operate on abstract tuples. But your point stands, probably better to ignore them for now. |
Fix up pure types in JIT
Fix up pure types in JIT
Fix up pure types in JIT
Fix up pure types in JIT
Uh oh!
There was an error while loading. Please reload this page.